package com.wimcorp.magic.abilities;

import javax.persistence.Entity;
import javax.persistence.Table;

import com.wimcorp.magic.abilities.trigger.AbilityTrigger;
import com.wimcorp.magic.behaviour.Behaviour;
import com.wimcorp.magic.board.CardType;
import com.wimcorp.magic.cards.Creature;
import com.wimcorp.magic.cards.Planeswalker;
import com.wimcorp.magic.cards.PlayingCard;
import com.wimcorp.magic.input.Target;

/**
 * example {target : 'THIS'}
 * 
 * target options : THIS
 * 
 */
@Entity
@Table(name = "sacrifice", schema = "abilities")
public class Sacrifice extends Ability {

	protected Sacrifice() {
	}

	public Sacrifice(AbilityTrigger trigger) {
		super(trigger);
	}
	
	public Sacrifice(Sacrifice ability) {
		super(ability);
	}

	@Override
	protected void executeAbility() {
		PlayingCard card = getAbilityTarget();
		if(card != null){
			getPlayer().getSummoningPlaines().getSacrifice().add(card);
			card.graveyard();
		}
	}

	@Override
	public Sacrifice clone() {
		return new Sacrifice(this);
	}
	
	@Override
	public boolean isInputRequired(){
		if (Target.THIS.equals(getTarget())) {
			return false;
		}
		return true;
	}

}
